<?php
$db=new PDO('mysql:host=localhost;dbname=db3','root','12qwas');
$ps=$db->prepare('select * from students limit :offset, :length');
$ps->bindValue(':offset',2,PDO::PARAM_INT);
$ps->bindValue(':length',2,PDO::PARAM_INT);
$ps->execute();
foreach ($ps as $r){
    echo "{$r['xh']}\t{$r['name']}\t{$r['age']}\n";
}